package com.example.liu.day9_17;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
        private EditText et_shuyuk;
        private Button but_tiaojiao;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
         et_shuyuk = findViewById(R.id.et_shuyuk);
        but_tiaojiao = findViewById(R.id.but_tiaojiao);
        but_tiaojiao.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, Main2Activity.class);
                startActivityForResult(intent,0);
            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (data !=null) {
            Bundle extras = data.getExtras();
            String string = extras.getString("lianxirun");
            et_shuyuk.setText(string);
        }
        return;
    }
}
